package cn.crc.pjblog.services;

import org.apache.tapestry.Link;

public class RedirectException extends RuntimeException {

	/**
	 * Tapestry5RedirectException
	 * @see http://wiki.apache.org/tapestry/Tapestry5RedirectException
	 * throw new RedirectException(SomePage.class);
	 *	
     *   or
     * throw new RedirectException("SomePage");
     * or
     *@Inject
     *ComponentResources resources; // use this to create a Link
     *Link link = resources.createPageLink( // etc

     *throw new RedirectException(link);
		
	 * need to configuration in  AppModule.java	
	 */
	 
	private static final long serialVersionUID = 7095874514105955104L;
	
	protected Link pageLink;
	protected Class<?> pageClass;
	
	public RedirectException(String papeName){
		
		super(papeName);
	}
	
	public RedirectException(Class<?> pageClass){
		
		this.pageClass = pageClass;
	}
	public RedirectException(Link link){
		
		this.pageLink =  link;
	}

	/**
	 * @return the pageClass
	 */
	public Class<?> getPageClass() {
		return pageClass;
	}

	/**
	 * @return the pageLink
	 */
	public Link getPageLink() {
		return pageLink;
	}
	
	
}
